package com.hdu.dwh.service.impl;

import org.apache.flink.table.api.Schema;
import org.apache.flink.table.api.TableDescriptor;
import org.apache.flink.table.api.TableEnvironment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hdu.dwh.dao.FlinkBaseDao;
import com.hdu.dwh.dao.PaimonBaseDao;
import com.hdu.dwh.pojos.source_access_pojos.DataWarehouseTable;
import com.hdu.dwh.service.ODSLayerService;

@Service
public class ODSLayerServiceImpl implements ODSLayerService{

    @Autowired
    private FlinkBaseDao flinkBaseDao;

    /**
     * 创建ODS层表(并导入数据),目标表名前默认添加"ods_"
     * @param sourceTable 源数据表对象
     * @param ODSTableName 目标表名
     * @param isStreamMode 是否流式导入数据
     */
    @Override
    public void createODSTable(DataWarehouseTable sourceTable, String ODSTableName, boolean isStreamMode) {
        // 获取flink环境
        TableEnvironment tenv = flinkBaseDao.getTableEnvironment();
        
        // 创建ODS表
        // TableDescriptor.forConnector("jdbc")
        //     .schema(Schema.newBuilder()
        //         .column(ODSTableName, ODSTableName))

        // tenv.createTable(ODSTableName, null);
    }

    @Override
    public void deleteODSTable(String ODSTableName) {
        // TODO Auto-generated method stub
        throw new UnsupportedOperationException("Unimplemented method 'deleteODSTable'");
    }
    
} 
